import { defineStore } from 'pinia'
import type { User, PartialUser } from '@/types/user'
import { ref } from 'vue'

export const useUserInfo = defineStore(
  'user',
  () => {
    const token = ref<string>()
    const setUserInfo = (val:string) => {
      token.value = val
    }

      return {
        token,
      setUserInfo
    }
  },
  {
    persist: {
      storage: {
        setItem (key, value) {
          uni.setStorageSync(key, value)
        },
        getItem (key) {
          return uni.getStorageSync(key)
        }
      }
    }
  }
)
